<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="format-detection" content="telephone=no" />
		<meta name="format-detection" content="email=no" />
		<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width;" />
		<title>积分提现</title>
		<link rel="stylesheet" type="text/css" href="../../css/person/changePassword.css" />
		<link rel="stylesheet" type="text/css" href="../../css/tool/comm.css" />

		<script type="text/javascript" src="../../plugins/zepto.js"></script>
  		<script type="text/javascript" src="../../js/tool/common.js"></script>
		
  		<link rel="stylesheet" type="text/css" href="../../plugins/layer/need/layer.css" />
  		<script type="text/javascript" src="../../plugins/layer/layer.js"></script>
	</head>
	<body style="background: #eee;">
		<div class="login-border">
			<div class="div-item">
				<div class="div-flag">手机号:</div>
				<div id="l_account" style="height: 42px;margin-top: 0px;" class="login-text"></div>
			</div>
			
			<div class="div-item">
				<div class="div-flag">积分数:</div>
				<div id="old_points" style="height: 42px;line-height: 42px;" class="login-text;" /></div>
			</div>

			<div class="div-item">
				<div class="div-flag">提取积分数:</div>
				<input id="l_newPoint" type="text" class="login-text" placeholder="请输入提取积分数" />
			</div>
			<p style="margin-left:5px;">累积1000积分可申请提现50元</P>
		</div>

		<div class="comm-bottom-btn" style="clear: both; margin-top:60px;" onclick="changePoint()">
			<span class="comm-bottom-span" >确认</span>
		</div>
	</body>
	<script type="text/javascript">
		$(function(){
			$('#l_account').html(dataGet("userPhone"));
			$('#old_points').html(dataGet("userPoints"));
		})

		function changePoint() {
			var oldPoints = $('#old_points').text();
			var newPoint = $('#l_newPoint').val();
			
			if(oldPoints < 1000) {
				alert("您的积分数小于1000，不能兑换。");
				return;
			}

			var userUuid = dataGet("userUuid");

			var data = "&crusrUuid="+userUuid+"&exchangePoint="+newPoint;
			var url = urlfile + "coreUser/update/rechargePoint";
			ajaxTool("post",data,url,
				function error(XMLHttpRequest, textStatus, errorThrown,fnErr){
					alert("error:" + data);
				},
				function success(data){
					if(!data.success) {
						alert(data.errMsg);
					}else{
						history.back();
					}
				}
			);
		}
	</script>
</html>